<?php

declare(strict_types=1);

use Phinx\Migration\AbstractMigration;

final class GoodsMigration extends AbstractMigration
{
    /**
     * Change Method.
     *
     * Write your reversible migrations using this method.
     *
     * More information on writing migrations is available here:
     * https://book.cakephp.org/phinx/0/en/migrations.html#the-change-method
     *
     * Remember to call "create()" or "update()" and NOT "save()" when working
     * with the Table class.
     */
    public function up(): void {
        
        $table = $this->table('goods',[
            'charset' => 'utf8mb4',
            'collation' => 'utf8mb4_general_ci'
        ]);

        $table->addColumn('title', 'string', ['limit' => 128,'collation' => 'utf8mb4_general_ci','null' => true])
            ->addColumn('image', 'string', ['limit' => 256,'collation' => 'utf8mb4_general_ci','null' => true])
            ->addColumn('sort_by', 'integer', ['limit' => 11,'null' => true])
            ->addColumn('created_at', 'integer', ['limit'=>11])
            ->addColumn('updated_at', 'integer', ['limit'=>11])
            ->save();
    }
}
